package errorx

const OKCode = 1
const ErrorCode = 0

var (

	//服务级错误 模块级错误 具体错误码
	//10        00       01
	ConfigExist = NewCodeError(100001, "配置已存在")
)

type CodeError struct {
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
	Detail string `json:"detail"`
}

func (e *CodeError) Error() string {
	return e.Msg
}
func NewCodeError(code int, msg string) error {
	return &CodeError{Code: code, Msg: msg}
}

func NewDefaultError(msg string) error {
	return NewCodeError(ErrorCode, msg)
}
